findElderByFloor = function() {
	if($('#vue_vm_list').length==0) {return;}
	$('#vue_vm_list div').hide();
	
	var floorId = $('#floor_select').val();
	var searchVal = floorId;
	
	if(isEmpty(searchVal)) {
		alert('请选择楼层');
		return;
	}
	
	find_basic_by_json(path+'/elderBeHospital/findByFloorId', {floorId: floorId}, function(response) {
		$('#vue_vm_list').html(gl_vue_vm_list_html);
		
		new Vue({
			el: '#vue_vm_list',
			data: {
				todos: response.data
			},
			methods: {
				getNowDiff: function(sDate1) {
					var nowDate = getNowFormatDate().substr(0,10);
					return DateDiff(nowDate, sDate1);
				},
				getSubsidizationValue:function(subsidization, subsidizationValue) {
					return getSubsidizationValue(subsidization, subsidizationValue);
				},
				getSubsidizationUnit:function(subsidization) {
					return getSubsidizationUnit(subsidization);
				},
				getSubsidizationText:function(subsidization, subsidizationValue) {
					return getSubsidizationText(subsidization, subsidizationValue);
				},
				getConsDeductionText:function(consumptionWay, consDeductionWay) {
					return getConsDeductionText(consumptionWay, consDeductionWay);
				},
				//总共可扣月数
				getTotalMonths:function(todo) {
					return getTotalMonths(todo);
				},
				//剩余可扣月数
				getRemainMonths:function(todo) {
					return getRemainMonths(todo);
				},
				//已扣月数
				getAlreadyUsedMonths:function(todo) {
					return getAlreadyUsedMonths(todo);
				},
				//总共可扣天数
				getTotalNumber:function(todo) {
					return getTotalNumber(todo);
				},
				//剩余可扣天数
				getRemainNumber:function(todo) {
					return getRemainNumber(todo);
				},
				//已扣天数
				getAlreadyUsedNumber:function(todo) {
					return getAlreadyUsedNumber(todo);
				},
				getChepingUrl:function(elderId, elderName, elderCardId) {
					return getChepingUrl(elderId, elderName, elderCardId);
				}
			}
		});
		
		view.data.elderId = response.data[0].elder.elderId;
		view.data.elderName = response.data[0].elder.name;
		view.data.sex = response.data[0].elder.sex;
		view.data.birthday = response.data[0].elder.birthday;
		view.data.peoples = response.data[0].elder.peoples;
		view.data.cardId = response.data[0].elder.cardId;
		view.data.maritalStatus = response.data[0].elder.maritalStatus;
		view.data.registeredResidence = response.data[0].elder.registeredResidence;
		view.data.liveAddress = response.data[0].elder.liveAddress;
		if(response.data[0].subjectRoom) {
			view.data.subjectRoomName = response.data[0].subjectRoom.roomName;
		}
		if(response.data[0].building) {
			view.data.buildingName = response.data[0].building.buildingName;
			view.data.floorName = response.data[0].floor.floorName;
			view.data.roomName = response.data[0].room.roomName;
			view.data.roomType = response.data[0].room.roomType;
			view.data.bedNumber = response.data[0].bed.bedNumber;
		}
		if(response.data[0].nursingCost) {
			view.data.nursingDesc = response.data[0].nursingCost.nursingCostName;
		}
		if(response.data[0].baseServiceCost) {
			view.data.baseServiceDesc = response.data[0].baseServiceCost.serviceName;
		}
		
		if(response.data[0].elderBeHospitalForm == null) {
			alert('该长者未办理入院登记');
			return;
		}
		view.data.elderBeHospitalId = response.data[0].elderBeHospitalForm.beHospitalId;
		//view.data.userVipCardForm = response.data[0].userVipCardForm;
		//view.data.elderBeHospitalForm = response.data[0].elderBeHospitalForm;
		
		if(response.data[0].nursingCost) {
			view.data.nursingCostForHalfMoon = (response.data[0].nursingCost.price/2).toFixed(2);
			$('#nursingCostForHalfMoon').text(view.data.nursingCostForHalfMoon+'元（半个月）');
		}
		
		/*
		view.data.baseServiceCostForHalfMoon = (response.data[0].baseServiceCost.price/2).toFixed(2);
		$('#baseServiceCostForHalfMoon').text(view.data.baseServiceCostForHalfMoon+'元（半个月）');
		*/
		
		if(response.data[0].baseServiceCost) {
			if(response.data[0].baseServiceCost.deductionWay=='半个月扣费') {
				view.data.baseServiceCostForHalfMoon = (response.data[0].baseServiceCost.price/2).toFixed(2);
				$('#baseServiceCostForHalfMoon').text(view.data.baseServiceCostForHalfMoon+'元（半个月）');
			}else {
				view.data.baseServiceCostForHalfMoon = response.data[0].baseServiceCost.price;
				$('#baseServiceCostForHalfMoon').text(view.data.baseServiceCostForHalfMoon+'元（一个月）');
			}
		}
		
		if(response.data[0].elderBeHospitalForm) {
			elderBeHospital = response.data[0].elderBeHospitalForm;
			
			view.data.houseTypeType = response.data[0].elderBeHospitalForm.houseTypeType;
			
			if(view.data.houseTypeType==1) {
				$('#houseTypeType').text('来源：VIP卡');
				if(response.data[0].userVipCardForm.consumptionWay=='半个月扣费') {
					view.data.bedCostForHalfMoon = response.data[0].userVipCardForm.pricePerDay*15;
					$('#bedCostForHalfMoon').text(view.data.bedCostForHalfMoon+'元（半个月）');
				}else {
					view.data.bedCostForHalfMoon = response.data[0].userVipCardForm.pricePerDay*30;
					$('#bedCostForHalfMoon').text(view.data.bedCostForHalfMoon+'元（一个月）');
				}
			}else {
				view.data.bedCostForHalfMoon = (response.data[0].elderBeHospitalForm.bedCostPrice/2).toFixed(2);
				$('#houseTypeType').text('来源：现金');
				$('#bedCostForHalfMoon').text(view.data.bedCostForHalfMoon+'元（半个月）');
			}
		}
		
		
		$('#vue_vm_list div').show();
		
		if(load_foodAllowance_select) {
			load_foodAllowance_select();
		}
		if(elderOutCost_findElderOutCost) {
			elderOutCost_findElderOutCost(elderBeHospital.beHospitalId);
		}
	});
}


function findBeHospitalByFloorId(floorId) {
	$('#vue_vm_list').html(gl_vue_vm_list_html);
	
	find_basic_by_json(path+'/elderBeHospital/findByFloorId', {floorId: floorId}, function(response) {
		for(var i=0; i<response.data.length; i++) {
			$('#elderBeHospital_select').append('<option value="' + response.data[i].beHospitalId
				+ '">' + response.data[i].elderForm.name + ' ' + response.data[i].roomNumber
				+ ' ' + response.data[i].bedNumber + '床</option>');
		}
		
		elderBeHospitalArray = response.data;
		
		_addChangeListener("#elderBeHospital_select", function() {
			var option = $('#elderBeHospital_select option:selected');
			var beHospitalId = $('#elderBeHospital_select').val();
			
			for(var i=0; i<elderBeHospitalArray.length; i++) {
				if(elderBeHospitalArray[i].beHospitalId==beHospitalId) {
					elderBeHospital = elderBeHospitalArray[i];
				}
			}
			
			if(view && view.data) {
				view.data = elderBeHospital;
				
				view.data.elderId = elderBeHospital.elderForm.elderId;
				view.data.elderName = elderBeHospital.elderForm.name;
			}
			
			if(elderFamilyMemberView && elderFamilyMemberView.data) {
				elderFamilyMemberView.data.elderId = elderBeHospital.elderForm.elderId;
				elderFamilyMemberView.data.elderName = elderBeHospital.elderForm.name;
			}
			
			if(load_elderFamilyMember_by_elderId) {
				load_elderFamilyMember_by_elderId(elderBeHospital.elderForm.elderId);
			}
		});
	});
}